import React from "react";
import { Redirect, Route } from "react-router-dom";

const PrivateRoute = ({ component: Component, ...rest }) =>
  Boolean(localStorage.getItem("isLogin")) === true ? (
    <Route {...rest} component={Component} />
  ) : (
    <Redirect
      to={{
        pathname: "/login",
        state: { from: this.state.location },
      }}
    />
  );

  export {
      PrivateRoute
  }
